<?php
declare (strict_types=1);

namespace app\admin\validate;

use think\Validate;

class Attribute extends Validate
{
    protected $rule = [
        'name'           => 'require',
        'is_sales'       => ['require', 'in' => '1,2'],
        'attribute_type' => ['require', 'in' => '1,2'],
        'status'         => ['require', 'in' => '1,2'],
    ];

    protected $message = [
        'name.require'   => '请输入属性名称',
        'is_sales'       => '是否是销售属性选择错误',
        'attribute_type' => '属性类型选择错误',
        'status'         => '请选择正确的状态',
    ];

    protected $scene = [
        'add'  => ['name', 'is_sales', 'attribute_type', 'status'],
        'edit' => ['name', 'status']
    ];
}
